<%@page import="java.util.ArrayList"%>
<%@page import="cn.sendto.model.ResidentInfoModel"%>
<%@page import="java.util.List"%>
<%@page import="cn.sendto.service.ResidentInfoService"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8" errorPage="../err.jsp"%>
<jsp:include page="../lock.jsp"></jsp:include>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>修改信息</title>
<style>
.txt20 {
	font-size: 20px;
}

.td {
	font-size: 18px;
	height: 50px;
	text-align: right;
}
.star{
	font-size:12px;
	color:red;
}
</style>
</head>

<body>
	<div class="txt20">当前位置-->修改学生信息</div>
	<%
		request.setCharacterEncoding("UTF-8");
		String id = request.getParameter("id");
		String username = "null";
		String userpass = "null";
		String name = "null";
		String tellphone = "null";
		ResidentInfoService ris = new ResidentInfoService();
		List<ResidentInfoModel> list = ris.selres(id);
		if (list.size() > 0) {
			username = list.get(0).getUserName();
			userpass = list.get(0).getUserPass();
			name = list.get(0).getName();
			tellphone= list.get(0).getTellphone();
		}

		//判断错误信息
		ArrayList<Integer> errlist = new ArrayList<Integer>();
		if (request.getAttribute("errinfo") != null) {
			errlist = (ArrayList<Integer>) request.getAttribute("errinfo");
		}
	%>
	<form action="domodresident.jsp" method="post">
		<input type="hidden" name="id" value="<%=id%>">
		<table width="95%" cellspacing="1" cellpadding="0" align="center"
			style="background-color: azure">
			<tr>
				<td colspan="2" height="30px"></td>
			</tr>
			<tr>
				<td class="td">用户名：</td>
				<td><input type="text" name="username" value="<%=username%>"
					readonly="readonly"></td>
			</tr>
			<tr>
				<td class="td">密码：</td>
				<td><input type="password" name="userpass"
					value="<%=userpass%>"> <%
 	for (int i = 0; i < errlist.size(); i++) {
 		if (errlist.get(i) == 2) {
 			out.println("<span class=\"star\">*请输入密码。</span>");
 			break;
 		}
 	}
 %></td>
			</tr>
			<tr>
				<td class="td">姓名：</td>
				<td><input type="text" name="name" value="<%=name%>"> <%
 	for (int i = 0; i < errlist.size(); i++) {
 		if (errlist.get(i) == 5) {
 			out.println("<span class=\"star\">*请输入姓名。</span>");
 			break;
 		}
 	}
 %></td>
			</tr>
		
			<tr>
				<td class="td">电话：</td>
				<td><input type="text" name="tellphone" value="<%=tellphone%>">
					<%
						for (int i = 0; i < errlist.size(); i++) {
							if (errlist.get(i) == 8) {
								out.println("<span class=\"star\">*请输入电话。</span>");
								break;
							}
						}
					%></td>
			</tr>
		
			<tr>
				<td></td>
				<td><input type="submit" value="提交"
					style="width: 100px; height: 25px"
					onclick="return confirm('是否确认修改')"></td>
			</tr>
		</table>
	</form>
</body>
</html>